package com.zretc.controller;

import com.zretc.dao.ShopsCollectMapper;
import com.zretc.entity.ShopsCollect;
import com.zretc.service.ShopsCollectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/shopsCollectController")
public class ShopsCollectController {
    @Autowired
    private ShopsCollectService shopsCollectService;

    /**
     * 添加店铺收藏
     *
     * @param shopsCollect 店铺对象
     * @return
     */


    @RequestMapping("/insertShopSConllect")
    @ResponseBody
    public boolean insertShopSConllect(ShopsCollect shopsCollect) {
        int n = shopsCollectService.saveShopsCollect(shopsCollect);
        if (n > 0) {
            return true;
        }
        return false;
    }

    /**
     * 从店铺收藏列表中删除
     *
     * @param shopsCollectId
     * @return
     */
    @RequestMapping("/deleteShopSConllect")
    @ResponseBody
    public boolean deleteShopSConllect(int shopsCollectId) {
        int n = shopsCollectService.deleteShopsCollectByCollectId(shopsCollectId);
        if (n > 0) {
            return true;
        }
        return false;
    }
}
